package com.bootdo.coach.result;

import java.util.HashMap;
import java.util.Map;

public class ResponseEntityUtil {
	
	public static Map<String, Object> getSucEntity() {
		
		return getSucEntity("操作成功");
	}
	
	public static Map<String, Object> getSucStringEntity(Map<String, String> data) {
		Map<String, Object> resultObj = new HashMap<String, Object>();
		resultObj.put("code", 0);
		resultObj.put("msg", "操作成功");
		if(data != null){
			resultObj.putAll(data);
		}
		return resultObj;
	}
	
	public static Map<String, Object> getSucEntity(Map<String, Object> data) {
		Map<String, Object> resultObj = new HashMap<String, Object>();
		resultObj.put("code", 0);
		resultObj.put("msg", "操作成功");
		if(data != null){
			resultObj.putAll(data);
		}
		return resultObj;
	}
	
	public static Map<String, Object> getSucEntity(String resultText) {
		return getSucEntity(resultText, null);
	}
	
	public static Map<String, Object> getSucEntity(String resultText, Map<String, Object> data) {
		Map<String, Object> resultObj = new HashMap<String, Object>();
		resultObj.put("code", 0);
		resultObj.put("msg", resultText);
		if(data != null){
			resultObj.putAll(data);
		}
		return resultObj;
	}
	
	public static Map<String, Object> getSucEntity(int code, String resultText, Map<String, Object> data) {
		Map<String, Object> resultObj = new HashMap<String, Object>();
		resultObj.put("code", code);
		resultObj.put("msg", resultText);
		if(data != null){
			resultObj.putAll(data);
		}
		return resultObj;
	}

	public static Map<String, Object> getFailEntity(int code, String resultText) {
		return getFailEntity(code, resultText, null);
	}

	public static Map<String, Object> getFailEntity(String resultText) {
		return getFailEntity(-1, resultText, null);
	}
	
	public static Map<String, Object> getFailEntity(String resultText, Map<String, Object> data) {
		return getFailEntity(-1, resultText, data);
	}
	
	public static Map<String, Object> getFailEntity(int code, String resultText, Map<String, Object> data) {
		Map<String, Object> resultObj = new HashMap<String, Object>();
		resultObj.put("code", code);
		resultObj.put("msg", resultText);
		if(data != null){
			resultObj.putAll(data);
		}
		return resultObj;
	}
	
}
